﻿using UnityEngine;
using System.Collections;


public class NetErrorWindow : MonoBehaviour
{
    public UILabel text;
    private System.Action onReconnect;
    public UIButton reconnectBtn;
    public UIButton reloginBtn;


    //private int errorType = 0;
    public void ShowNetError(int errorType, System.Action onClick)
    {
        //this.errorType = errorType;
        //短链接错误
        if (errorType == 1)
        {
            text.text = LanguageTool.GetTextNoUpdate(1031);
        }
        else
        {
            text.text = LanguageTool.GetTextNoUpdate(1030);
        }
        onReconnect = onClick;
    }

    public void BackToLogin()
    {
        ManagerController.Instance.BackToLogin();
        Destroy(gameObject);
    }

    public void ConnectAgain()
    {
        if (onReconnect != null)
        {
            onReconnect();
        }
    }
}
